package com.punai.common.constant;

public class CsPermissionConstants {


    public enum ConversionType{

        ADDRESS("addressList",0,"地区","addressDesc"),
        MODULE("moduleList",1,"功能","moduleDesc"),
        INDUSTRY("industryList",2,"专业","industryDesc"),
        TEMP("tempList",3,"模板","tempDesc");

        private String name;
        private Integer type;
        private String desc;
        private String descKey;


        ConversionType(String name, Integer type,String desc,String descKey) {
            this.name = name;
            this.type = type;
            this.desc = desc;
            this.descKey = descKey;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Integer getType() {
            return type;
        }

        public void setType(Integer type) {
            this.type = type;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }

        public String getDescKey() {
            return descKey;
        }

        public void setDescKey(String descKey) {
            this.descKey = descKey;
        }

        public static Integer getTypeByName(String name) {
            for (ConversionType value : ConversionType.values()) {
                if (value.getName().equals(name)) {
                    return value.getType();
                }
            }
            return null;
        }

        public static Integer getTypeByDesc(String name) {
            for (ConversionType value : ConversionType.values()) {
                if (value.getDesc().equals(name)) {
                    return value.getType();
                }
            }
            return null;
        }

        public static String getDescByType(Integer type) {
            for (ConversionType value : ConversionType.values()) {
                if (value.getType().equals(type)) {
                    return value.getDesc();
                }
            }
            return null;
        }
        public static String getDescByName(String name) {
            for (ConversionType value : ConversionType.values()) {
                if (value.getName().equals(name)) {
                    return value.getDesc();
                }
            }
            return null;
        }
        public static String getDescKeyByName(String name) {
            for (ConversionType value : ConversionType.values()) {
                if (value.getName().equals(name)) {
                    return value.getDescKey();
                }
            }
            return null;
        }
    }

}
